package com.atguigu.springbootkafka.controller;

import org.springframework.kafka.core.KafkaTemplate;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import javax.annotation.Resource;

@RestController
@RequestMapping("/send")
public class PeoducerController {
    @Resource
    KafkaTemplate<String,String> kafka;
    @GetMapping("/data")
    public String data(String msg){
        //通过kafka发送数据
        kafka.send("first",msg);
        return msg;
    }

}
